﻿using UnityEngine;

public class QualityManager : MonoBehaviour
{
    public GameObject waterLow;
    public Light sunLight;
    public GameObject SmallProps;
    public GameObject SkyProps;
    public GameObject Trees;

    private void Start()
    {
        onQualityChange();
        Mainloop.Instance.onQualityChange += onQualityChange;
    }

    private void OnDestroy()
    {
        Mainloop.Instance.onQualityChange -= onQualityChange;
    }

    void onQualityChange()
    {
        int currentQuality = Mainloop.Instance.QualityLevel;

        //Sky
        if (currentQuality >= 4)
        {
            SkyProps.SetActive(true);
        }
        else
        {
            SkyProps.SetActive(false);
        }

        //Tree
        if (currentQuality >= 3)
        {
            Trees.SetActive(true);
        }
        else
        {
            Trees.SetActive(false);
        }

        //Small Props
        if (currentQuality >= 2)
        {
            SmallProps.SetActive(true);
        }
        else
        {
            SmallProps.SetActive(false);
        }

    }
}
